[% title = topic.title _ ' : ' _ forum.name %]

[% url_prefix = forum.forum_url _ '/' _ topic.topic_id %]

[% c.load_once("jquery.ui/themes/flora/flora.all.css") %]

<div id='edit_profile_tabs' class='tabs'>
    <ul class="ui-tabs-nav">
        <li><a href='[% forum.forum_url %]'><span>Topics</span></a></li>
        <li><a href='[% forum.forum_url %]/polls'><span>Polls</span></a></li>
        <li><a href='[% forum.forum_url %]/topic/new'><span>[% c.loc("New Topic") %]</span></a></li>
        <li><a href='[% forum.forum_url %]/poll/new'><span>[% c.loc("New Poll") %]</span></a></li>
        <li><a href='[% forum.forum_url %]/action_log'><span>View Action Logs</span></a></li>
        <li class="ui-tabs-selected"><a href='javascript:void(0)'><span>[% topic.title %]([% topic.hit %])</span></a></li>
        [% UNLESS topic.closed %]
        <li><a href='[% forum.forum_url %]/[% topic.topic_id %]/reply'><span>Reply Topic</span></a></li>
        [% END %]
    </ul>
    <div class="ui-tabs-container">

[% IF c.user_exists %]
[% c.load_once("site/star.js") %]
[% END %]

<div class='one'>
<table align='center'>
[% IF roles.is_moderator %]
<tr class='title'>
    <td width='100'>Operation</td><td align='center'>
    <a href='[% url_prefix %]/[% IF topic.sticky %]unsticky[% ELSE %]sticky[% END %]'>[% IF topic.sticky %][% c.loc('Unsticky') %][% ELSE %][% c.loc('Sticky') %][% END %]</a> |
    <a href='[% url_prefix %]/[% IF topic.closed %]unlock[% ELSE %]lock[% END %]'>[% IF topic.closed %][% c.loc('Unlock') %][% ELSE %][% c.loc('Lock') %][% END %]</a> |
    <a href='[% url_prefix %]/[% IF topic.elite %]unelite[% ELSE %]elite[% END %]'>[% IF topic.elite %][% c.loc('Unelite') %][% ELSE %][% c.loc('Elite') %][% END %]</a> |
    <a href='[% url_prefix %]/[% IF topic.status == 'banned' %]unban[% ELSE %]ban[% END %]'>[% IF topic.status == 'banned' %][% c.loc('Unban') %][% ELSE %][% c.loc('Ban') %][% END %]</a>
    </td>
</tr>
[% END %]
<tr class='title'>
    <td colspan='2'>
    [% IF c.user_exists %]
    <a href="javascript:star('topic', '[% topic.topic_id %]', 'starDiv')"><span id='starDiv'><img src="[% c.config.dir.images %]/site/t/star_[% IF is_starred;'on';ELSE;'off';END %].gif" align='absmiddle' /> [% IF is_starred;'Unstar';ELSE;'Star';END %]</span></a> | 
    <a href="javascript:share('topic', '[% topic.topic_id %]', 'shareDiv')"><span id='shareDiv'><img src='[% c.config.dir.images %]/site/t/[% IF is_shared;'unshare';ELSE;'share';END %].gif' /> [% IF is_shared;'Unshare';ELSE;'Share';END %]</span></a>
    [% END %]
    <a href='http://del.icio.us/post?url=[% c.req.base _ c.req.path  | uri %]&title=[% title | uri %]'><img src='[% c.config.dir.images %]/site/s/delicious.gif' align='absmiddle' />del.icio.us</a> 
    <a href='http://digg.com/submit?phase=2&URL=[% c.req.base _ c.req.path | uri %]'><img src='[% c.config.dir.images %]/site/s/digg.gif' align='absmiddle' />digg</a>
    </td>
</tr>
</table>
</div>

[% FOREACH comment IN comments %]
<div class='multi'>
<table align='center'>
<tr class='reply[% IF loop.count mod 2;'2';ELSE;'1';END; %]'>
    <td valign='top' width='157'>
        [% INCLUDE include/user_profile.html user = comment.author %]
    </td>
	<td valign='top' width='*'>
	  <div><b>[% comment.title %]</b></div>
	  <div class='horizontal'></div>
	  <table width='100%' cellpadding='0' cellspacing='0' height='120' style="TABLE-LAYOUT: fixed">
	  <tr valign='top'><td class="textbody">
	  <span class="postclass">
	  [% IF comment.author.status == 'banned' %]
	    The author is banned.
	  [% ELSE %]
	    [% IF comment.upload %]
	    [% INCLUDE upload/upload.html upload = comment.upload %]
	    [% END %]
	    [% comment.text %]
	  [% END %]
	  </span>
      </td></tr>
      </table>
      <br>
      <div class='horizontal'></div>
       [% UNLESS topic.closed %]
       <a href='[% url_prefix %]/[% comment.comment_id %]/reply'><img src='[% c.config.dir.images %]/replynow.gif' width='16' height='15' align='absmiddle'> [% c.loc('Reply') %]</a>
       [% END %]
       [% IF roles.is_moderator OR comment.author.user_id == c.user.user_id %]
       <a href='[% url_prefix %]/[% comment.comment_id %]/edit'><img src='[% c.config.dir.images %]/edit.gif' width='16' height='15' align='absmiddle'> [% c.loc('Edit') %]</a>
       [%# END %]
       [%# IF roles.is_moderator %]
       [%# IF loop.count != 1 %]
       <a href='[% url_prefix %]/[% comment.comment_id %]/delete'><img src='[% c.config.dir.images %]/del.gif' width='16' height='15' align='absmiddle'> [% c.loc('Delete') %]</a>
       [%# END %]
       [% END %]
       <img src='[% c.config.dir.images %]/posttime.gif' width='16' height='15' align='absmiddle'> <span class='date'>[% comment.post_on %]</span>
    </td>
</tr>
</table>
</div>
[% END %]
<div class='none'>
<table align='center'>
    <tr><td align='right'>[% INCLUDE 'sub/pager.html' pager = comments_pager %]</td></tr>
</table>
</div>

[% IF c.user_exists AND NOT topic.closed %]
<br />
<div class='one'>
<form method='post' action='[% url_prefix %]/reply' enctype="multipart/form-data">
<table align='center'>
    <tr class='title'><td colspan='2'>[% c.loc('Reply') %]</td></tr>
    <tr class='misc1'><td align='right'>[% c.loc('Title') %]</td><td><input type='text' name='title' size='64' maxlength='80' /></td></tr>
    <tr class='misc2'><td align='right'>[% c.loc('Content') %]</td><td><textarea name='text' style='width: 100%' rows="15"></textarea></td></tr>
    <tr class='misc1'><td align='right'>[% c.loc('Upload Attachment') %]</td><td>
    [% INCLUDE upload/input.html %]
    </td></tr>
    <tr class='misc2'><td></td><td><input type='submit' /></td></tr>
</table>
</form>
</div>
[% END %]

    </div>
</div>